import { request } from '@boeyo/portal';

//设备版本列表
export const getDeviceVersionList = async (params) => {
  return request({
    url: 'deviceVersion/list',
    method: 'GET',
    params,
  });
};

/**
 * 新增版本
 * @ss.hasPermi('deviceVersion:add')
 */
export const AddDeviceVersion = (data) => {
  return request({
    url: 'deviceVersion/add',
    method: 'POST',
    data,
  });
};
/**
 * 删除版本
 * @ss.hasPermi('project:delete')
 */
export const deleteDeviceVersion = (ids: number[]) => {
  return request({
    url: `deviceVersion/delete/${ids}`,
    method: 'DELETE',
  });
};

/**
 * 通用上传请求（单个）
 */
export const uploadFile = (data) => {
  return request({
    url: '/file/uploadFile',
    method: 'POST',
    data,
  });
};

//设备列表
export const getDeviceList = async (params: any) => {
  return await request({
    url: 'device/list',
    method: 'GET',
    params,
  });
};

// 点击推送versionPushTotalLog/add返回id，通过id再请求sse
/**
 * 新增推送记录总
 * @ss.hasPermi('versionPushTotalLog:add')
 */
export const addVersionPush = (data) => {
  return request({
    url: '/versionPushTotalLog/add',
    method: 'POST',
    data,
  });
};

//设备推送记录总览
export const getDevicePushAllList = async (params) => {
  return request({
    url: '/versionPushTotalLog/byVersionId',
    method: 'GET',
    params,
  });
};

/**
 * 推送设备记录详情列表
 * @ss.hasPermi('versionPushLog:query')
 */
export const getDeviceLogList = (params) => {
  return request({
    url: '/versionPushLog/logList',
    method: 'GET',
    params,
  });
};
